﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package tool {
    import flash.display.*;
    import org.aswing.*;
    import Classes.*;
    import org.aswing.event.*;
    import flash.system.*;
    import Display.aswingui.*;

    public class OffsetEditorMover extends JPanel {

        private var m_child:DisplayObject;
        private var m_label:JLabel;
        private var m_gameObject:GameObject;
        private var m_parent:Boolean = false;
        private var m_alphaCounter:int = 0;

        public function OffsetEditorMover(_arg1:DisplayObject, _arg2:GameObject, _arg3:Boolean=false){
            this.m_child = _arg1;
            this.m_gameObject = _arg2;
            this.m_parent = _arg3;
            this.m_alphaCounter = 0;
            super(new FlowLayout(FlowLayout.CENTER, 2, 2, true));
            this.m_label = new JLabel(((("x=000" + _arg1.x) + "/y=000") + _arg1.y));
            this.m_label.setFont(this.m_label.getFont().changeSize(16));
            this.setText();
            var _local4:JButton = new JButton("U1");
            _local4.addActionListener(this.up1, 0, true);
            var _local5:JButton = new JButton("D1");
            _local5.addActionListener(this.down1, 0, true);
            var _local6:JButton = new JButton("L1");
            _local6.addActionListener(this.left1, 0, true);
            var _local7:JButton = new JButton("R1");
            _local7.addActionListener(this.right1, 0, true);
            var _local8:JButton = new JButton("U10");
            _local8.addActionListener(this.up10, 0, true);
            var _local9:JButton = new JButton("D10");
            _local9.addActionListener(this.down10, 0, true);
            var _local10:JButton = new JButton("L10");
            _local10.addActionListener(this.left10, 0, true);
            var _local11:JButton = new JButton("R10");
            _local11.addActionListener(this.right10, 0, true);
            var _local12:JPanel = ASwingHelper.makeSoftBoxJPanel();
            var _local13:JButton = new JButton("Trans");
            _local13.addActionListener(this.ToggleTrans, 0, true);
            _local12.appendAll(ASwingHelper.horizontalStrut(10), this.m_label, _local4, _local5, _local6, _local7, _local8, _local9, _local10, _local11, _local13, ASwingHelper.horizontalStrut(50));
            ASwingHelper.prepare(_local12);
            append(_local12);
            ASwingHelper.prepare(this);
        }
        private function ToggleTrans(_arg1:AWEvent):void{
            this.m_alphaCounter++;
            if (this.m_alphaCounter == 1){
                this.m_child.alpha = 0.7;
            } else {
                if (this.m_alphaCounter == 2){
                    this.m_child.alpha = 0.3;
                } else {
                    this.m_child.alpha = 1;
                    this.m_alphaCounter = 0;
                };
            };
        }
        private function setText():void{
            this.m_label.setText((((((this.m_parent) ? "Parent:" : "child:" + "x=") + this.m_child.x) + "/y=") + this.m_child.y));
            if (!this.m_child.stage){
                OffsetEditor.selected = null;
                OffsetEditor.instance.consider(this.m_gameObject);
            };
            ASwingHelper.prepare(this);
        }
        private function up1(_arg1:AWEvent):void{
            this.m_child.y = (this.m_child.y - 1);
            System.setClipboard((((("offsetX=\"" + this.m_child.x) + "\" offsetY=\"") + this.m_child.y) + "\""));
            this.setText();
        }
        private function down1(_arg1:AWEvent):void{
            this.m_child.y = (this.m_child.y + 1);
            System.setClipboard((((("offsetX=\"" + this.m_child.x) + "\" offsetY=\"") + this.m_child.y) + "\""));
            this.setText();
        }
        private function left1(_arg1:AWEvent):void{
            this.m_child.x = (this.m_child.x - 1);
            System.setClipboard((((("offsetX=\"" + this.m_child.x) + "\" offsetY=\"") + this.m_child.y) + "\""));
            this.setText();
        }
        private function right1(_arg1:AWEvent):void{
            this.m_child.x = (this.m_child.x + 1);
            System.setClipboard((((("offsetX=\"" + this.m_child.x) + "\" offsetY=\"") + this.m_child.y) + "\""));
            this.setText();
        }
        private function up10(_arg1:AWEvent):void{
            this.m_child.y = (this.m_child.y - 10);
            System.setClipboard((((("offsetX=\"" + this.m_child.x) + "\" offsetY=\"") + this.m_child.y) + "\""));
            this.setText();
        }
        private function down10(_arg1:AWEvent):void{
            this.m_child.y = (this.m_child.y + 10);
            System.setClipboard((((("offsetX=\"" + this.m_child.x) + "\" offsetY=\"") + this.m_child.y) + "\""));
            this.setText();
        }
        private function left10(_arg1:AWEvent):void{
            this.m_child.x = (this.m_child.x - 10);
            System.setClipboard((((("offsetX=\"" + this.m_child.x) + "\" offsetY=\"") + this.m_child.y) + "\""));
            this.setText();
        }
        private function right10(_arg1:AWEvent):void{
            this.m_child.x = (this.m_child.x + 10);
            System.setClipboard((((("offsetX=\"" + this.m_child.x) + "\" offsetY=\"") + this.m_child.y) + "\""));
            this.setText();
        }

    }
}//package tool 
